package com.youlu.campus.admin.zm.msg;

import lombok.Data;

import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;

/**
 * @author : [dengbo]
 * @className : ZmResponse
 * @description : [x消息返回类]
 * @createTime : [2022/11/10 18:52]
 */
@Data
public class ZmResponse<T extends MsgObject> implements Serializable {
    private int res;
    private String msg;
    private List<T> data = new LinkedList<>();

    public static <T extends MsgObject> ZmResponse success(T t) {
        ZmResponse<T> q = new ZmResponse();
        q.data.add(t);
        q.res = 0;
        return q;
    }

    public ZmResponse addData(T t) {
        this.data.add(t);
        return this;
    }
}
